Bookmark
Using DBI Effectively: bind_columns() | bluefeet
blog.bluefeet.net/2011/08/using-dbi-effectively-bind_columns/, posted 2011 by peter in development howto perl storage
There are two important reasons why bind_columns() is so awesome:
First, it greatly reduces the complexity of the code within the while() loop since you do not have to lookup in to an array ($sth->fetchrow_array()), de-reference an array ($sth->fetchrow_array()), or de-reference a hash-ref ($sth->fetchrow_hashref()). Instead the values themselves are available via appropriately named scalars.
Secondly, when using bind_columns() DBI is re-using the same scalars every time a fetch() is done which is much faster than creating an array or hash every fetch and typically causes the values to be copied one less time than normal. Benchmark it yourself – bind_columns() can make a huge difference when processing large sets of data.